#include "kit/event/UnfollowEvent.hpp"
#include <string>
#include <vector>
#include "kit/tool/Tokenizer.hpp"

namespace KitEvent
{

	UnfollowEvent::~UnfollowEvent()
	{

	}
	void UnfollowEvent::execute(KitUser::UserMap * iUsers)
	{
		// check if the user that is followed exists
		if(isValid(iUsers))
		{
			// if exists then remove the follower from his list
			iUsers->get(_message->getTo())->removeFollower(_message->getFrom());
		}
	}

	bool UnfollowEvent::isValid(KitUser::UserMap * iUsers)
	{
		return iUsers->contains(_message->getTo());
	}

}

